package vfs.service;

import java.util.Iterator;
import vfs.filter.VFSFilter;
import vfs.obj.entity.VFSGroup;

/**
 *
 * @author Matthew Eavenson <durandal@uga.edu>
 * 
 */
public interface VFSGroupService {
    
    /**
     * Returns a group with the given name.
     * 
     * @param name the requested group's name
     * @return the group with the given name if it exists, null otherwise
     */
    VFSGroup getGroup(String name);
    
    /**
     * Returns an iterator over groups, given a filter.
     * 
     * @param filter the filter over the group query
     * @return an iterator over any groups that fit the given filter
     */
    Iterator<VFSGroup> getGroups(VFSFilter filter);
    
    /**
     * Returns whether a group exists.
     * 
     * @param name the name of the group
     * @return true if the group exists, false otherwise
     */
    boolean exists(String name);
    
    /**
     * Creates a new group.
     * 
     * @param name the new group's name
     * @return a newly created group
     */
    VFSGroup create(String name);
    
    /**
     * Renames a given group.
     * 
     * @param group the group to be renamed
     * @param name the new name of the given group
     * @return true if the group was renamed successfully, false otherwise
     */
    boolean rename(VFSGroup group, String name);
    
    /**
     * Removes a group with the given name.
     * 
     * @param name the name of the group to be removed
     * @return true if the group was removed successfully, false otherwise
     */
    boolean remove(String name);
    
    /**
     * Removes a group.
     * 
     * @param group the group to be removed
     * @return true if the group was removed successfully, false otherwise
     */
    boolean remove(VFSGroup group);
    
}
